package com.imc.api.lesson;

import com.imc.platform.base.lesson.service.LessonService;
import com.twp.common.component.process.exception.combo.IComboExecptionForTFunc;
import com.twp.common.tuple.ResultDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 方法描述:小程序Banner图片链接的接口
 * GRC 2018-10-29 10:26:57
 */
@Slf4j
@RestController
@RequestMapping("/api/lesson")
public class LessonApiController {

    @Autowired
    IComboExecptionForTFunc iComboExecptionForTFunc;//基本服务操作类

    @Autowired
    LessonService lessonService;

    /*
     * YT  2018/10/29 22:26
     * 方法描述：根据banner图片链接点击课程或者视频详情信息
     */
    @GetMapping("/queryLessonInfoByLessonId")
    public ResultDTO queryLessonInfoByLessonId(@RequestParam String lessonId)  {
        return iComboExecptionForTFunc.executeFlow(
                ResultDTO.builder().message("获取课程视频信息成功").build(),
                t -> {
                    t.setData(lessonService.queryLessonDetByLessonId(lessonId));
                },
                (e, t) -> {
                    e.printStackTrace();
                    t.setIsSuccess(false);
                    t.setMessage("获取失败");
                }
        );
    }
}